package com.ruoyi.qsng.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.SnowFlakeUtil;
import com.ruoyi.qsng.domain.KCourseDiploma;
import com.ruoyi.qsng.mapper.KCourseDiplomaMapper;
import com.ruoyi.qsng.service.IKCourseDiplomaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 课程奖状Service业务层处理
 *
 * @author kanglou
 * @date 2023-06-07
 */
@Service
public class KCourseDiplomaServiceImpl implements IKCourseDiplomaService {
    @Autowired
    private KCourseDiplomaMapper kCourseDiplomaMapper;

    /**
     * 查询课程奖状
     *
     * @param id 课程奖状主键
     * @return 课程奖状
     */
    @Override
    public KCourseDiploma selectKCourseDiplomaById(String id) {
        return kCourseDiplomaMapper.selectKCourseDiplomaById(id);
    }

    /**
     * 查询课程奖状列表
     *
     * @param kCourseDiploma 课程奖状
     * @return 课程奖状
     */
    @Override
    public List<KCourseDiploma> selectKCourseDiplomaList(KCourseDiploma kCourseDiploma) {
        return kCourseDiplomaMapper.selectKCourseDiplomaList(kCourseDiploma);
    }

    /**
     * 查询课程奖状列表
     *
     * @param kCourseDiploma 课程奖状
     * @return 课程奖状集合
     */
    @Override
    public List<KCourseDiploma> selectKCourseDiplomaDataList(KCourseDiploma kCourseDiploma) {
        return kCourseDiplomaMapper.selectKCourseDiplomaDataList(kCourseDiploma);
    }

    /**
     * 新增课程奖状
     *
     * @param kCourseDiploma 课程奖状
     * @return 结果
     */
    @Override
    public int insertKCourseDiploma(KCourseDiploma kCourseDiploma) {
        kCourseDiploma.setId(SnowFlakeUtil.getNextId());
        kCourseDiploma.setCreateTime(DateUtils.getNowDate());
        return kCourseDiplomaMapper.insertKCourseDiploma(kCourseDiploma);
    }

    /**
     * 修改课程奖状
     *
     * @param kCourseDiploma 课程奖状
     * @return 结果
     */
    @Override
    public int updateKCourseDiploma(KCourseDiploma kCourseDiploma) {
        kCourseDiploma.setUpdateTime(DateUtils.getNowDate());
        return kCourseDiplomaMapper.updateKCourseDiploma(kCourseDiploma);
    }

    /**
     * 批量删除课程奖状
     *
     * @param ids 需要删除的课程奖状主键
     * @return 结果
     */
    @Override
    public int deleteKCourseDiplomaByIds(String[] ids) {
        return kCourseDiplomaMapper.deleteKCourseDiplomaByIds(ids);
    }

    /**
     * 删除课程奖状信息
     *
     * @param id 课程奖状主键
     * @return 结果
     */
    @Override
    public int deleteKCourseDiplomaById(String id) {
        return kCourseDiplomaMapper.deleteKCourseDiplomaById(id);
    }
}
